<?php
class GraduaString {
    public static function removeSpacesAndCapitalizeFirstLetters($name) {
        $pieces = explode(' ',ucwords($name));
        $clearPieces = array();
        foreach($pieces as $p) {
            $p = trim($p);
            if($p) {
                $clearPieces[] = $p;
            }
        }
        return implode($clearPieces);
    }
}
?>
